<template>
  <iframe class="zy-frame" frameborder="0" :src="this.$route.params.link"></iframe>
</template>

<script>
import resourcemgApi from "@/api/medicinal";

export default {
  data() {
    return {
      loading: false,
      list: [{ m_name: "", m_price_link: "" }],
      filename: __filename,
      link: this.$route.params.name
    };
  },

  created() {
    console.log(this.$route.params.link);
  },

  watch: {
    // 监听相同路由下参数变化的时候，从而实现异步刷新
    // $route(to, from) {
    //   做一些路由变化的响应
    //   this.loading = true;
    //   this.test()
    //   this.loading = false;
    //   if(to.params.name != from.params.name){
    //     this.fetchLink();
    //   }
    //   if (to.query.name !== from.query.name) {
    //     this.fetchLink();
    //   }
    // }
  },

  // beforeRouteUpdate(to, from, next) {
  //   from.$route.meta.title = this.$route.meta.title
  //   next()
  // },

  methods: {
    sleep(d) {
      return new Promise(resolve => setTimeout(resolve, d));
    },
    // 设置睡眠时间，好像没啥用
    async test() {
      await this.sleep(2000);
    },
  }
};
</script>

<style lang="scss" scoped>
.zy-frame {
  position: absolute;
  top: 0px;
  left: 0px;
  height: 100%;
  width: 100%;
}
</style>